<%--
  Created by IntelliJ IDEA.
  User: HP
  Date: 2024/12/23
  Time: 19:14
  To change this template use File | Settings | File Templates.
--%>
Created by IntelliJ IDEA.
User: admin
Date: 2024/11/21
Time: 10:30
To change this template use File | Settings | File Templates.
-%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--html css js jquery bootstarp --%>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"/>
<script type="text/javascript">
    function register() {
        let username = document.getElementById("username").value;
        let password = document.getElementById("password").value;
// json data
        let jsonData = {"username":username, "passmord": password}
//convert to json obj
        let json0bj = JSON.stringify(jsonData);

        $.ajax({
            type: 'post',
            contentType: 'application/json; charset=utf-8',
            data: json0bj,
            url: '${pageContext.request.contextPath}/stu/insert.do',
            success:function (respData) {

            },
        })
    }

</script>
<html>
<head>
    <title>Title</title>
</head>
<body>
用户名: <input type="text" name="username" id="username"><br>
密码: <input type="text" name="passmord" id="password"><br>
<input type="button" value="注册" onclick="register()">
</body>
</html>